package com.huawei.gamebox.service.common.cardkit.card;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout.LayoutParams;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.gamebox.service.common.cardkit.bean.BannerEntryCardBean;
import o.azb;
import o.cgz;
import o.chy;
import o.eqx;
import o.evx;
import o.exp$a;
import o.exp.d;

public class LeavesFlatpCard extends BaseGsCard {
    private Context ˋ;
    private int ˎ = -1;
    private int ॱ = 2;

    public LeavesFlatpCard(Context context) {
        super(context);
        this.ˋ = context;
    }

    public void ˋ(int i) {
        this.ॱ = i;
    }

    public int ˎ() {
        return this.ˎ;
    }

    public void ˊ(int i) {
        this.ˎ = i;
    }

    public cgz ˏ(View view) {
        ˏ((ImageView) view.findViewById(d.ॱㆍ));
        ʽ(view);
        return this;
    }

    public void ˎ(BaseCardBean baseCardBean) {
        if (baseCardBean instanceof BannerEntryCardBean) {
            BannerEntryCardBean bannerEntryCardBean = (BannerEntryCardBean) baseCardBean;
            ˊ(bannerEntryCardBean.ॱˌ(), bannerEntryCardBean.v_());
        }
    }

    private void ˊ(String str, String str2) {
        int ॱ = azb.ॱ(this.ˋ);
        int ˎ = ˎ();
        if (ˎ < 0) {
            ˎ = ᐝ();
        }
        ॱ = (ॱ - ˎ) / this.ॱ;
        int i = (int) (((float) ॱ) / 2.0f);
        LayoutParams layoutParams = (LayoutParams) this.ʽॱ.getLayoutParams();
        layoutParams.width = ॱ;
        layoutParams.height = i;
        this.ʽॱ.setContentDescription(str2);
        this.ʽॱ.setLayoutParams(layoutParams);
        eqx.ˏ(this.ʽॱ, str, "image_default_icon");
    }

    public void ॱ(final chy o_chy) {
        ʼॱ().setOnClickListener(new evx(this) {
            final /* synthetic */ LeavesFlatpCard ॱ;

            public void ˋ(View view) {
                o_chy.ˏ(0, this.ॱ);
            }
        });
    }

    protected int ᐝ() {
        return (this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ʾ) * 2) + (this.ʼॱ.getResources().getDimensionPixelSize(exp$a.ʽॱ) * (this.ॱ - 1));
    }
}
